cmake_minimum_required(VERSION 3.25)

project(greptui)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wno-sign-compare -Wno-implicit-fallthrough -Wno-write-strings")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)


file(GLOB SRC_FILES
    src/*.cc
)

add_executable(greptui
    ${SRC_FILES}
)



target_include_directories(greptui
    PRIVATE
    include
)

# pkg-config program
find_package(PkgConfig REQUIRED)
# ncurses lib
pkg_check_modules(CURSES REQUIRED ncurses)
# libconfig lib
pkg_check_modules(LIBCONFIG REQUIRED libconfig)
find_library(LIBCONFIG_LIBRARY NAMES config libconfig
    HINTS ${LIBCONFIG_LIBDIR}
)
# pcre lib
pkg_check_modules(LIBPCRE REQUIRED libpcre)
find_library(LIBPCRE_LIBRARY NAMES pcre libpcre 
    HINTS ${LIBPCRE_LIBDIR}
)

target_include_directories(greptui
    PRIVATE
    ${CURSES_INCLUDE_DIRS} 
    ${LIBCONFIG_INCLUDE_DIRS} 
    ${LIBPCRE_INCLUDE_DIRS}
)

target_link_libraries(greptui
    ${CURSES_LIBRARIES} 
    ${LIBPCRE_LIBRARY} 
    ${LIBCONFIG_LIBRARY}
    pthread
)





#add_subdirectory()

#enable_testing()

